<template>
  <div id="app">
    <h1>hello,world</h1>
    <button @click="getStudents">获取学生信息</button>
     <button @click="getCars">获取车辆信息</button>
  </div>
</template>

<script>
import axios from "axios"
export default {
  name: 'App',
  methods: {
    getStudents(){
      console.log('获取学生信息')
      axios.get('http://localhost:8080/api1/students').then(response =>{
        console.log('学生信息',response.data);
      },error =>{
        console.log('error',error.message);
      })
    },
    getCars(){
      console.log('获取车辆信息')
      axios.get('http://localhost:8080/api2/cars').then(response =>{
        console.log('车辆信息',response.data);
      },error =>{
        console.log('error',error.message);
      })
    }
  },
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
